<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    //1.模型关联的表
    protected $table = 'role';

    //2.表的主键
    public $primaryKey = 'id';

    //3.是否允许批量操作字段
    //protected $fillable = [];
    protected $guarded = [];

    //4.是否维护create_at和update_at字段
    public $timestamps = false;

    //添加动态属性，关联权限模型
    public function permission(){
        return $this->belongsToMany("app\Model\Permission","role_permission","role_id","permission_id");
    }
}
